
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>奖惩信息查询</title>
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">
    <link rel="stylesheet" href="/css/notice/noticeManagement.css">
    <script src="/js/common/language.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style>
        table tbody td{
            text-align: left;
            padding: 10px;
            box-sizing: border-box;
        }
        table tbody td.color{
            padding:10px 10px 10px 50px;
        }
        input{
            float: none;
        }
        .editAndDelete3{
            color: red;
        }
        .color{
            font-size: 11pt;
            color: #2a588c;
            font-weight: bold;
        }
        table tbody td textarea{
            width: 229px;
            height: 34px;
            line-height: 34px;
            padding-left: 10px;
            outline: none;
            border-radius: 4px;
            vertical-align: middle;
            font-family:"Microsoft Yahei";
        }
        table tbody td a{
            vertical-align: middle;
            font-size: 11pt;
        }
        table tbody td select{
            width: 119px;
            height: 28px;
            border-radius: 4px;
        }
        table tbody td input[type=text]{
            width: 288px;
            height: 32px;
            border-radius: 4px;
            padding-left: 10px;
            box-sizing: border-box;
        }
        .btnsava{
            padding:5px 15px;
            border-radius: 4px;
            background: #2F8AE3;
            color: #fff;
        }
        .pagediv .page-bottom-outer-layer table td{
            text-align: left;
        }
        #pagediv{
            width: 100%;
        }
        #pagediv table{
            width: 80%;
            margin: 0 auto;
        }
        #pagediv table tr:nth-child(odd){
            background-color: #F6F7F9;
        }
        #pagediv table tr:nth-child(even){
            background-color: #ffffff;
        }
        #pagediv table tr th{
            padding: 8px;
            font-size: 13pt;
            color: #2F5C8F;
            font-weight: bold;
            text-align: left;
        }
        #pagediv table tr td{
            padding: 8px;
            font-size: 11pt;
            text-align: left;
        }
    </style>
    <%--<script src="/js/notice/theQuery.js"></script>--%>
</head>
<body>
<div class="navigation">
    <img src="/img/commonTheme/${sessionScope.InterfaceModel}/gonggaochaxun.png" alt="">
    <h2>奖惩信息查询</h2>
</div>
<div class="query">
    <div class="header">奖惩信息查询</div>
    <form id="ajaxform" action="">
        <input type="hidden" name="changeId" value="1">
        <input type="hidden" name="exportId" value="">
        <table style="width: 100%;    border: 1px solid #c0c0c0;
    border-top: none;">
            <tbody>
            <tr class="borderNone">
                <td width="30%" class="color">单位员工：</td>
                <td width="70%">
                    <textarea name="" placeholder="请选择员工" class="theControlData" readonly="readonly" id="reles" cols="30" rows="10"></textarea>
                    <a href="javascript:;" class="addroles"><fmt:message code="global.lang.add"/></a>
                    <a href="javascript:;" class="cleardate"><fmt:message code="global.lang.empty"/></a>
                    <input type="hidden" name="fromId">
                </td>
            </tr>
            <tr class="borderNone">
                <td width="30%" class="color">奖惩日期：</td>
                <td width="70%">
                    <input type="text" placeholder="<fmt:message code="adding.th.Start"/>" name="beginDate" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" readonly="readonly" style="width: 128px">
                    <span><fmt:message code="global.lang.to"/></span>
                    <input type="text" placeholder="<fmt:message code="adding.th.end"/>" name="endDate" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  style="width: 128px" readonly="readonly">
                </td>
            </tr>
            <tr class="borderNone">
                <td width="30%"  class="color">奖惩项目</td>
                <td width="70%">
                    <input type="hidden" name="incentiveItem" value="">
                    <select id="incentiveItem">
                        <option value="">项目名称</option>
                        <option value="积极参加工作">积极参加工作</option>
                        <option value="不迟到不早退">不迟到不早退</option>
                        <option value="违规操作">违规操作</option>
                        <option value="经常迟到早退">经常迟到早退</option>
                    </select>
                </td>
            </tr>
            <tr class="borderNone">
                <td width="30%"  class="color">奖惩属性</td>
                <td width="70%">
                    <input type="hidden" name="incentiveType" value="">
                    <select id="incentiveType">
                        <option value="">请选择</option>
                        <option value="奖励">奖励</option>
                        <option value="惩罚">惩罚</option>
                    </select>
                </td>
            </tr>
            <tr class="borderNone">
                <td colspan="2" style="text-align: center">
                    <a href="javascript:;" class="btnsava" id="queryBtn"><fmt:message code="global.lang.query"/></a>
                    <a href="javascript:;" style="margin-left: 10px" class="btnsava"><fmt:message code="global.lang.report"/></a>
                    <%--<a href="javascript:;" style="margin-left: 10px" class="btnsava chongtian"  ><fmt:message code="global.lang.refillings"/></a>--%>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<div id="pagediv" style="display: none;">
    <table cellspacing="0" cellpadding="0" style="border-collapse:collapse;">
        <thead>
        <tr>
            <th style="width: 40px;">选择</th>
            <th>单位员工</th>
            <th>奖惩项目</th>
            <th>奖惩日期</th>
            <th>奖惩属性</th>
            <th>奖惩金额</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="trList">

        </tbody>
    </table>
    <div class="right" style="margin-right: 10%;">
        <!-- 分页按钮-->
        <div class="M-box3" id="dbgz_pagesd"></div>
    </div>
</div>

<script type="text/javascript">
    var user_id='';
    $(function () {
        $('.addroles').click(function () {
            user_id='reles';
            $.popWindow("../../common/selectUser");
        });
        $('.cleardate').click(function () {
            $('#reles').attr('username','');
            $('#reles').attr('dataid','');
            $('#reles').attr('user_id','');
            $('#reles').attr('userprivname','');
            $('#reles').val('');
        })

        //        删除
        $('#trList').on('click','.deleteData',function () {
            var dataId=$(this).parents('tr').attr('data-id');
            layer.confirm('确定删除该条数据吗？', {
                btn: ['确定','取消'], //按钮
                title:"删除"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'',
                    dataType:'json',
                    data:{
                        incentiveId:dataId
                    },
                    success:function(res){
                        if(res.flag){
                            layer.msg('删除成功！', { icon:6});
                            ajaxPage.page();
                        }else {
                            layer.msg('删除失败！', { icon:5});
                        }

                    }
                })

            }, function(){
                layer.closeAll();
            });
        })


//        查询
        $('#queryBtn').click(function () {
            $('.query').hide();
            $('#pagediv').show();
            ajaxPage.page();
        })

        var ajaxPage={
            data:{
                page:1,//当前处于第几页
                pageSize:10,//一页显示几条
                useFlag:true,
                staffName:$('#reles').val(),
                beginDate:$('input[name="beginDate"]').val(),
                endTime:$('input[name="endDate"]').val(),
                incentiveItem:$('#incentiveItem option:selected').val(),
                incentiveType:$('#incentiveType option:selected').val()
            },
            page:function () {
                var me=this;
                $.ajax({
                    type:'get',
                    url:'',
                    dataType:'json',
                    data:me.data,
                    success:function(res){
                        var str='';
                        var str_s='';
                        var datas=res.obj;
                        if(datas.length > 0){
                            for(var i=0;i<datas.length;i++){
                                str+='<tr data-id="'+datas[i].incentiveId+'">' +
                                    '<td><input type="checkbox" name="checkChild"></td>' +
                                    '<td>'+dataundefined(datas[i].userName)+'</td>' +
                                    '<td>'+dataundefined(datas[i].incentiveItem)+'</td>' +
                                    '<td>'+dataundefined(datas[i].incentiveTime)+'</td>' +
                                    '<td>'+dataundefined(datas[i].incentiveType)+'</td>' +
                                    '<td>'+dataundefined(datas[i].incentiveAmount)+'</td>' +
                                    '<td>' +
                                    '<a href="javascript:;" class="detailsData">查看详情</a>' +
                                    '<a href="javascript:;" class="editData" style="margin: 0 10px;">编辑</a>' +
                                    '<a href="javascript:;" class="deleteData">删除</a>' +
                                    '</td>' +
                                    '</tr>'
                            }
//                                str_s='<tr><td colspan="7"><input type="checkbox"><span>全选</span><span>删除</span></td></tr>'
                        }

                        $('#trList').html(str);
                        me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)

                    }
                });

            },
            pageTwo:function (totalData, pageSize,indexs) {
                var mes=this;
                $('#dbgz_pagesd').pagination({
                    totalData: totalData,
                    showData: pageSize,
                    jump: true,
                    coping: true,
                    homePage:'',
                    endPage: '',
                    current:indexs||1,
                    callback: function (index) {
                        mes.data.page=index.getCurrent();
                        mes.page();
                    }
                });
            }
        }

    })

    function dataundefined(data) {
        if(data == undefined){
            return '';
        }else {
            return data;
        }
    }

</script>

</body>
</html>